import request from '@/utils/request'
import API from './contants'

/**
 * 根据电话号码获取验证码
 * @param {*} phone
 * @returns
 */
export const getCode = phone => request({
  url: API.CODE_API + '/' + phone,
})

/**
 * 用户登录，发送 POST 请求后端登录接口，需要传递电话号码和验证码到后端
 * @param {*} phone
 * @param {*} code
 * @returns
 */
export const loginAsync = (phone, code) => request({
  url: API.SESSION_API,
  method: 'POST',
  data: {
    phone,
    code,
  },
})
